package com.dgut.common.service.impl;

import java.util.List;
import java.util.Set;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dgut.common.mapper.GoodMapper;
import com.dgut.common.model.entity.Goods;
import com.dgut.common.service.GoodService;

/**
 * @author huangyujia <huangyujia@kuaishou.com>
 * Created on 2024-06-18
 */
@Service
public class GoodServiceImpl extends ServiceImpl<GoodMapper, Goods> implements GoodService {

    @Override
    public List<Goods> getList() {
        return lambdaQuery()
                .eq(Goods::getStatus, 0)
                .list();
    }

    @Override
    public void deleteById(String id) {
        lambdaUpdate()
                .set(Goods::getStatus, 1)
                .eq(Goods::getId, id);
    }

    @Override
    public List<Goods> getByIds(Set<String> goodIds) {
        return lambdaQuery()
                .in(Goods::getId, goodIds)
                .eq(Goods::getStatus, 0)
                .list();
    }
}
